# Maintainer: Marty Plummer (The_NetZ) <ntzrmtthihu777 (at) gmail (dot) com>

_realname=SDL2_image

pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2.0.0
pkgrel=2
pkgdesc=("A simple library to load images of various formats as SDL surfaces (Version 2)")
arch=('any')
url="http://www.libsdl.org/projects/SDL_image"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-SDL2"
        "${MINGW_PACKAGE_PREFIX}-libpng"
        "${MINGW_PACKAGE_PREFIX}-libtiff" 
        "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
        "${MINGW_PACKAGE_PREFIX}-libwebp")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake")
source=("${url}/release/${_realname}-${pkgver}.tar.gz")
sha1sums=('20b1b0db9dd540d6d5e40c7da8a39c6a81248865')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}/"
  "${srcdir}"/${_realname}-${pkgver}/configure \
    --disable-static \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}/"

  make DESTDIR="${pkgdir}/" install
  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING.txt" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
